<!-- 成本管理详情弹窗 -->
<template>
            <a-form
                    ref="form3"
                    class="ele-form-detail"
                    :model="costModalApp.cost"
                    :label-col="{md: {span: 2}, sm: {span: 4}, xs: {span: 6}}"
                    :wrapper-col="{md: {span: 22}, sm: {span: 20}, xs: {span: 18}}">
                <a-descriptions :title="costModalApp.title" bordered>
                                    <a-descriptions-item label="标识">
                        {{ costModalApp.cost.Eid }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人">
                        {{ costModalApp.cost.creatorName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="名称">
                        {{ costModalApp.cost.name }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="业务id">
                        {{ costModalApp.cost.businessId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="实体名称">
                        {{ costModalApp.cost.entityName }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="成本类型">
                        {{ costModalApp.cost.type }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="数量">
                        {{ costModalApp.cost.amount }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="单价">
                        {{ costModalApp.cost.price }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="状态">
                        {{ costModalApp.cost.status }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建人ID">
                        {{ costModalApp.cost.creatorId }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="备注">
                        {{ costModalApp.cost.remark }}
                    </a-descriptions-item>
                                    <a-descriptions-item label="创建时间">
                        {{ costModalApp.cost.createDatetime }}
                    </a-descriptions-item>
                                </a-descriptions>
            </a-form>
</template>

<script>
    import {defineComponent, reactive, onMounted, inject} from "vue";
    import {useRoute} from "vue-router"
    import {CostService} from "@/views/restaurant/material/cost/costService";

    export default defineComponent({
        setup() {
            const route = useRoute();
            let routeId = route.params.id;
            let costListApp = inject('costListApp', reactive({}));
            const costModalApp = reactive({id: null, cost: {}, display: false});

            onMounted(() => {
                    costModalApp.cost = {};
                if (routeId) {
                        costModalApp.id = routeId;
                } else if (costListApp.viewModalShowing) {
                        costModalApp.id = costListApp.currentId;
                        costModalApp.display = true;
                }
                if (costModalApp.id) {
                    getInfo(costModalApp.id);
                }
            })

            const getInfo = (id) => {
                    CostService.findCost(id).then((res) => {
                            costModalApp.cost = res.data;
                            costModalApp.title = "查看 " + costModalApp.cost.name;
                })
            }

            return {
                    costModalApp,
                routeId,
                getInfo,
            }
        }
    })
</script>

<style scoped>
</style>

